package com.zjj.disk.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.constraints.Pattern;
import java.time.LocalDateTime;

/**
 * @author zjj
 * @create 2023-03-25 20:46
 */
@Data
public class User {
    @TableId(type = IdType.AUTO)
    private Integer id;
    @Length(min = 2, max = 9)
    private String username;
    @NotEmpty
    @Pattern(
            regexp = "^[a-zA-Z]\\w{5,17}$",
            message = "以字母开头，长度在6~18之间，只能包含字母、数字和下划线"
    )
    private String password;
    @Email
    private String email;
    private Integer role;
    private String salt;
    private String activationCode;
    private LocalDateTime activationTime;
    private Integer isVaild;
    @TableLogic
    private Integer isDeleted;
}
